import json
from flask import request
from . import users_bp
from controller.users_controller import UserAuth
from controller.users_controller import LoginController

check_token = UserAuth.login_verify


@users_bp.route('/user_wxlogin', methods=['GET', 'POST'])
def user_wxlogin():
    return UserAuth.user_wxlogin(json, request)


@users_bp.route('/user_login', methods=['POST'])
def user_login():
    return LoginController.user_login(request)


@users_bp.route('/user_register', methods=['POST'])
def user_register():
    return LoginController.user_register(request)


@users_bp.route('/modify_password', methods=['POST'])
@check_token
def modify_password():
    return LoginController.modify_password(request)


@users_bp.route('/user_list', methods=['POST'])
@check_token
def user_list():
    return LoginController.user_list(request)


@users_bp.route('/user_info', methods=['POST'])
@check_token
def user_info():
    return LoginController.user_info(request)


@users_bp.route('/user_purchased_files', methods=['POST'])
@check_token
def user_purchased_files():
    return LoginController.user_purchased_files(request)

